package com.langsotech.studio.pojo.infodirector.tableTreeViewer;
import java.util.List;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import com.langsotech.studio.pojo.infodirector.data.PageItem;
public class TableTreeViewerContentProvider implements ITreeContentProvider{
	@Override
	public Object[] getChildren(Object parentElement) {
		PageItem entry = (PageItem)parentElement;
		List entity = entry.getChildren();
		if(entity==null||entity.isEmpty()){
			return new Object[0];
		}
		else return entity.toArray();
	}
	@Override
	public Object getParent(Object element) {
		return null;
	}
	@Override
	public boolean hasChildren(Object element) {
		PageItem entry = (PageItem)element;
		List list = entry.getChildren();
		if(list ==null||list.isEmpty())
			return false;
		else return true;
	}
	@Override
	public Object[] getElements(Object inputElement) {
		if(inputElement instanceof List){
			List list = (List)inputElement;
			return list.toArray();
		}
		else 
			return new Object[0];
	}
	@Override
	public void dispose() {
	}
	@Override
	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
	}
}
